//
//  MainIconCell.m
//  QuickCure
//
//  Created by Kent on 16/9/13.
//  Copyright © 2016年 haoge. All rights reserved.
//

#import "MainIconCell.h"

@interface MainIconCell ()

@property (nonatomic,weak) UIImageView *imgView;

@property (nonatomic,weak) UILabel *label;

@end

@implementation MainIconCell

-(void)UISetupWithName:(NSString *)name image:(UIImage *)image  {
    
    if (self.imgView && self.label) {
        [self.imgView removeFromSuperview];
        [self.label removeFromSuperview];
        
    }
    
    UIImageView *imgView = [[UIImageView alloc]init];
    imgView.image = image;
    self.imgView = imgView;
    [self.contentView addSubview:imgView];
    
    [imgView makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.contentView);
        make.top.equalTo(self.contentView).offset(5);
        make.width.equalTo(50);
        make.height.equalTo(45);
    }];
    
    UILabel *label = [[UILabel alloc]init];
    label.text = name;
    label.font = kFONT11;
    self.label = label;
    [self.contentView addSubview:label];
    
    [label makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.contentView);
        make.top.equalTo(imgView.bottom).offset(5);
    }];
    
    
}

@end

























